'use strict';

const { validatorSensitive } = require('../common/index');

module.exports = {
  name: [
    { required: true, message: '房屋标题必填' },
    { type: 'string', message: '房屋标题必须为字符串' },
    { min: 0, max: 20, message: '房屋标题长度最大20字' },
    { validator: validatorSensitive() },
  ],
  address: [
    { required: true, message: '房屋地址必填' },
    { type: 'string', message: '房屋地址必须为字符串' },
    { min: 0, max: 1000, message: '房屋地址长度最大1000字' },
  ],
  rent: [
    { required: true, message: '房屋租金必填' },
    { type: 'number', message: '房屋租金必须是数字' },
    { type: 'number', min: 0, max: 10000, message: '房屋租金最大为10000' },
  ],
  lon: [
    { required: true, message: '经纬度必填' },
    { type: 'number', message: '经纬度必须是数字' },
  ],
  lat: [
    { required: true, message: '经纬度必填' },
    { type: 'number', message: '经纬度必须是数字' },
  ],
  areaId: [
    { required: true, message: '地区必填' },
    { type: 'number', message: '地区格式错误' },
  ],
  description: [
    { required: true, message: '房屋描述必填' },
    { type: 'string', message: '房屋描述必须为字符串' },
    { min: 0, max: 1000, message: '房屋描述长度最大1000字' },
    { validator: validatorSensitive() },
  ],
};
